<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('专家管理列表')" />
    <th:block th:include="include :: bootstrap-select-css" />

</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>专家姓名：</label>
                                <input type="text" name="expertName"/>
                            </li>

                            <li>
                                <label>曾任职务：</label>
                                <input type="text" name="positions"/>
                            </li>
                            <li class="select-time">
                                <label>受聘年份：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginEmploymentTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endEmploymentTime]"/>
                            </li>
                            <li>
                                <label>审读范围：</label>
                                <select name="reviewScope" class=" noselect2 selectpicker" th:with="type=${@dict.getType('re_review_scope')}" data-none-selected-text="请选择审读范围" >
                                    <option value="">所有</option>

                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>

                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.addTab()"  shiro:hasPermission="publish:managementt:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="publish:managementt:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
               <!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="publish:managementt:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>-->
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="publish:managementt:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcelRecord('formId')" shiro:hasPermission="publish:managementt:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-select-js" />

    <script th:inline="javascript">
        var editFlag = "";
        var removeFlag = "";
        var prefix = ctx + "publish/managementt";

        $(function() {
            var options = {
                url: prefix + "/listmoney",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importTemplateUrl: prefix + "/importTemplate",
                importUrl: prefix + "/importData",
                detailUrl:prefix + "/detail/{id}",
                modalName: "专家管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'expertName',
                    title: '专家姓名',
                    sortable: true,
                    formatter: function(value, row, index){
                        var actions = [];
                        actions.push("<span style='cursor: pointer;' onclick='openWindow(\""+row.id+"\")'>"+value+"</span>")
                        return actions.join('');
                    }
                },
                {
                    field: 'by1',
                    title: '联系电话',
                    sortable: true,
                },
                // {
                //     field: 'birthday',
                //     title: '出生年月',
                //
                // },

                {
                field: 'employmentTime',
                title: '受聘年份',
                formatter: function(value, row, index) {

                    return   value  ;
                    //layui.util.toDateString(value, 'yyyy年-MM月-dd日 HH:mm:ss')

                },
                    sortable: true,
                },
                {
                    field: 'positions',
                    title: '曾任职务',
                    sortable: true,
                },
                {
                    field: 'reviewScope',
                    title: '审读范围',
                    sortable: true,
                },
                {
                    field: 'reviewedNumber',
                    title: '已审样本数',
                    sortable: true,
                },
                {
                    field: 'manuscriptFee',
                    title: '稿费',
                    sortable: true,
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a style="margin-left:3px" class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.id + '\')"><i class="fa fa-book"></i>查看</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function openWindow(user){
            $.modal.openTab("专家稿件", "/publish/review/reviewUser/"+user);
        }
    </script>

     <!-- 导入区域 -->
     <script id="importTpl" type="text/template">
         <form enctype="multipart/form-data" class="mt20 mb10">
             <div class="col-xs-offset-1">
                 <input type="file" id="file" name="file"/>
                 <div class="mt10 pt5">
                     <!--                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据-->
                     &nbsp;	<a href="/excelTemplate/managementt/专家模板.xlsx" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
                 </div>
                 <font color="red" class="pull-left mt10">
                     提示：仅允许导入“xls”或“xlsx”格式文件！
                 </font>
             </div>
         </form>
     </script>
</body>
</html>